﻿<!DOCTYPE html>
<html lang="es">
    <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
        <meta charset="utf-8" />
        <title>@ViewBag.Title - Generacion E</title>
        <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
        <meta name="viewport" content="width=device-width" />
        @Styles.Render("~/Content/css")
        @Styles.Render("~/Content/themes/metroblue/css")
        @Scripts.Render("~/bundles/modernizr")
    </head>
    <body>
        <header>
            <div class="content-wrapper">
                <div class="float-left">
                    <p class="site-title"><img src="~/Images/generacione.jpg" /></p>
                </div>
                <div class="float-right">
                    <section id="login">
                        @Html.Partial("_LoginPartial")
                    </section>
                    <nav>
                        @Html.Partial("_MenuPartial")
                    </nav>
                </div>
            </div>
        </header>
        <div id="body">
            @RenderSection("featured", required: false)
            <section class="content-wrapper main-content clear-fix">
                @RenderBody()
                <div id="ui-dialog-resultado">
                    <p id="p-resultado" class="centered"></p>
                </div>
                <div id="ui-dialog-error">
                    <p id="p-error" class="red centered"></p>
                </div>
            </section>
        </div>
        <footer>
            <div class="content-wrapper">
                <div class="float-left">
                    <p>&copy; @DateTime.Now.Year - GeneracionE</p>
                </div>
            </div>
        </footer>

        @Scripts.Render("~/bundles/jquery")
        @Scripts.Render("~/bundles/jqueryui")
        @Scripts.Render("~/bundles/jqueryadd")
        @Scripts.Render("~/bundles/jqueryvalidationEngine")
        @RenderSection("scripts", required: false)
        <script type="text/javascript">
            $(function () {
                $('.menu').jqsimplemenu();
                $('#ui-dialog-resultado').dialog({
                    title: "Resultado OK", autoOpen: false, modal: true, draggable: true,
                    height: "auto", resizable: true, width: 300, buttons: { "Aceptar": function () { $(this).dialog("close"); } }
                });
                $('#ui-dialog-error').dialog({
                    title: "Error", autoOpen: false, modal: true, draggable: true,
                    height: "auto", resizable: true, width: 300, buttons: { "Aceptar": function () { $(this).dialog("close"); } }
                });
            });
            function GetAppURL() {
                return '/SWGeneracionE';
            }
            function FormatNumber(number) {
                if (number != null) {
                    if (typeof number === 'string') {
                        if (number != '')
                            return Number(number).toFixed(2);
                    } else {
                        return number.toFixed(2);
                    }
                }
                return '';
            }
            function _ajaxCall(options) {
                var jsonSerialized = JSON.stringify(options.data);
                $.ajax({
                    type: "POST",
                    url: options.url,
                    dataType: "json",
                    contentType: "application/json; charset=utf-8",
                    data: jsonSerialized,
                    success: function (result) {
                        if (result.Result == 'OK') {
                            options.success(result);
                        } else {
                            $('#p-error').html(result.Message);
                            $('#ui-dialog-error').dialog('open');
                        }
                    },
                    error: function (error) {
                        $('#p-error').html('Ocurri&oacute un error en el servidor.<br/>Intente nuevamente');
                        $('#ui-dialog-error').dialog('open');
                    }
                });
            }
            function ColorEstadoPago(estado) {
                switch (estado) {
                    case '@SWGeneracionE.Constantes.STR_ESTADOPAGO_AUTORIZADO':
                        return 'green';
                    default:
                        return 'red';
                }
            }
        </script>
    </body>
</html>
